Add OMP provider and model alias mapping#59
Add OMP provider and model alias mapping#59cgrossde wants to merge 2 commits intogetagentseal:mainfrom
Conversation
- Add OMP provider reading from ~/.omp/agent/sessions (same JSONL format as Pi, shared parser) - Parameterize discoverSessionsInDir with provider name so sessions carry correct provider field - Add BUILTIN_ALIASES for proxy model name variants (anthropic--claude-* double-dash format) that don't match LiteLLM keys - Add model-alias CLI command for user-defined name mappings - Wire setModelAliases into preAction after config load - Add modelAliases field to CodeburnConfig - Update README: OMP in provider table, model-alias section
…ories OMP stores sub-agent JSONL files one level deeper than the project dir: ~/.omp/agent/sessions/<project>/<session-id>/<agent-name>.jsonl The previous flat readdir scan only found files directly inside the project dir, missing all sub-agent sessions entirely. - Extract collectJsonlFromDir helper that recurses one level into subdirectories within each project dir - Extend collectDiscoverySnapshot to also record mtime of sub-session subdirectories (adding files inside a subdir does not bump the parent dir mtime, so cache invalidation would otherwise never trigger) - Add test covering sub-agent session discovery
0c5c6fa to
03c351c
Compare
|
@iamtoruk If you find some time, please have a look. Let me know if you would like to see some changes or prefer not to merge this. |
|
Hey Chris, thanks for this. The OMP provider and the model-alias work are both useful, and the tests are thorough. I wanted to land it cleanly today so I did the rebase work on our side and pushed a reconciled branch to our origin: https://github.com/getagentseal/codeburn/tree/feat/omp-support-model-aliases Since main moved quite a bit while this PR was open (PR #117 just merged, and we went through Node 22+ / node:sqlite changes) there were six conflict files to work through. I kept your OMP provider and alias feature as-is and applied a few small fixups on top that I want to flag:
Everything passes: 378 tests, cached-vs-uncached parity exact, and the One thing I need from you before I merge: the feature commit's author is set to If that's awkward or you'd rather not, let me know and I'll merge from our branch instead and credit you in the CHANGELOG and merge commit message. Either way works for me. Thanks again. |
firstlook
Details
|
What this adds
OMP provider support
Oh My Pi stores sessions at
~/.omp/agent/sessions/in the same JSONL format as Pi. This PR adds OMP as a first-class provider so its sessions are discovered and tracked automatically.ompprovider reads from~/.omp/agent/sessions/<sanitized-cwd>/*.jsonlprovider: 'omp'so the--provider ompfilter worksModel alias mapping
Proxies and self-hosted LLM gateways often rewrite model names before they reach the client. When a model name doesn't match any LiteLLM entry,
calculateCostreturns 0 and the session shows$0.00. There was no way to fix this without a codeburn release.This PR adds a user-configurable alias map:
Aliases are stored in
~/.config/codeburn/config.jsonalongside the currency setting and applied at startup before any pricing lookup. User aliases take precedence over built-ins.Built-in aliases ship for known proxy model name variants — specifically the
anthropic--claude-4.6-opusdouble-dash dot-version format emitted by some Anthropic-compatible proxies — so common cases work out of the box without any configuration.Resolution order:
getCanonicalNamestrips structural noise first (pin suffixes, date stamps,provider/slash prefixes), thenresolveAliasmaps the result to the canonical key used by LiteLLM and the fallback pricing table.Files changed
src/providers/pi.ts— OMP provider factory and singleton;discoverSessionsInDirparameterized by provider namesrc/providers/index.ts— OMP registered in core providerssrc/models.ts—BUILTIN_ALIASES,setModelAliases,resolveAlias; alias resolution wired intogetModelCostsandgetShortModelNamesrc/config.ts—modelAliasesfield added toCodeburnConfigsrc/cli.ts—model-aliascommand;setModelAliasescalled inpreActionREADME.md— OMP in provider table and requirements; new Model aliases sectiontests/providers/omp.test.ts— newtests/models.test.ts— new, covers builtin aliases, user aliases, override precedence, and existing model names